<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="/js/jquery-1.12.4.js"></script>
  <style>
    table {
      border: 1px solid black;
    }

    td {
      width: 100px;
      border: 1px solid black;
    }

    .od {
      background-color: green;
    }

    .re {
      background-color: pink;
    }
  </style>
</head>

<body>
  <table>
    <tr>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>
    <tr>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
      <td>2</td>
    </tr>
    <tr>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
    </tr>
    <tr>
      <td>4</td>
      <td>4</td>
      <td>4</td>
      <td>4</td>
      <td>4</td>
    </tr>
    <tr>
      <td>5</td>
      <td>5</td>
      <td>5</td>
      <td>5</td>
      <td>5</td>
    </tr>
    <tr>
      <td>6</td>
      <td>6</td>
      <td>6</td>
      <td>6</td>
      <td>6</td>
    </tr>
  </table>
</body>
<script>
  $(document).ready(function () {
    // 选择文章内容的段落元素
    $("table tr").each(function (index) {
      // 判断奇偶性
      if (index % 2 === 0) {
        $(this).addClass("od");
      } else {
        $(this).addClass("re");
      }
    });
  });
</script>


</html>